﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ElementControl : MonoBehaviour {
    public int State;
    public float U;
    public float I;
    public float R;
    public float Re_R;
    public float E; //电池提供电压
    public float Q;
    public float C; //电容
    public float L; //电感

    private Animator m_Animator;
    private GameObject dianLiuCube;
    // Use this for initialization
    void Start () {
        m_Animator = GetComponent<Animator> ();
        dianLiuCube = transform.Find("Cube").gameObject;
    }

    // Update is called once per frame
    void Update () {
        if (R != 0) {
            I = U / R;
        }
        if (C != 0) {
            Q = C * U;
        }
        dianLiuCube.SetActive(I != 0);
    }

    void Click () {
        print (name + "被点击啦！");

    }

    void DoubleClick () {
        State = (State + 1) % 2;
        if (m_Animator != null) {
            m_Animator.SetInteger ("State", State);
        }
    }
}